package com.hex.ds.hdtp.core.app.script.transfer.converter;

import cn.hutool.core.date.DateUtil;
import com.hex.ds.hdtp.core.app.common.constant.ScriptConvertContants;
import com.hex.ds.hdtp.core.app.script.transfer.dto.response.ScriptConvertSourceListResponseDto;
import com.hex.hdtp.scf.basic.convert.entity.ConvertConfig;
import com.hex.hdtp.scf.oracle.model.OracleConvertConfig;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

@Mapper(componentModel = "spring", imports = {DateUtil.class})
public interface IScriptConvertConvert {

    @Mapping(target = "sourceFilePath", source = "scriptConvertList.sourceFileAbsolutePath")
    @Mapping(target = "targetFilePath", source = "scriptConvertList.convertFilePath")
    @Mapping(target = "author", source = "scriptConvertContants.author")
    @Mapping(target = "lengthCoefficient", source = "scriptConvertContants.lengthCoefficient")
    @Mapping(target = "date", expression = "java(DateUtil.today())")
    @Mapping(target = "pyHullMode", source = "scriptConvertContants.pyHullMode")
    @Mapping(target = "needCast", source = "scriptConvertContants.needCast")
    @Mapping(target = "sourceDatabase", source = "scriptConvertContants.sourceDatabase")
    @Mapping(target = "targetDatabase", source = "scriptConvertContants.targetDatabase")
    OracleConvertConfig oracleScriptConvert(ScriptConvertSourceListResponseDto scriptConvertList, ScriptConvertContants scriptConvertContants);
}
